/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package top.dzygod.modules.mp.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://dzygod.top
* @description /
* @author dzygod
* @date 2020-08-06
**/
@Entity
@Data
@Table(name="wx_order")
public class Order implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "order_id")
    @ApiModelProperty(value = "订单主键")
    private Long orderId;

    @Column(name = "open_id")
    @ApiModelProperty(value = "用户在appid下唯一标识")
    private String openId;

    @Column(name = "is_subscribe")
    @ApiModelProperty(value = "是否关注公众号")
    private String isSubscribe;

    @Column(name = "trade_type")
    @ApiModelProperty(value = "交易类型")
    private String tradeType;

    @Column(name = "bank_type")
    @ApiModelProperty(value = "付款银行")
    private String bankType;

    @Column(name = "total_fee")
    @ApiModelProperty(value = "付款金额")
    private Integer totalFee;

    @Column(name = "fee_type")
    @ApiModelProperty(value = "货币种类")
    private String feeType;

    @Column(name = "cash_fee")
    @ApiModelProperty(value = "现金支付金额")
    private Integer cashFee;

    @Column(name = "transaction_id")
    @ApiModelProperty(value = "微信支付订单号")
    private String transactionId;

    @Column(name = "out_trade_no")
    @ApiModelProperty(value = "商户订单号")
    private String outTradeNo;

    @Column(name = "time_end")
    @ApiModelProperty(value = "支付完成时间")
    private String timeEnd;

    @Column(name = "app_id")
    @ApiModelProperty(value = "公众账号id")
    private String appId;

    @Column(name = "mch_id")
    @ApiModelProperty(value = "商户号")
    private String mchId;

    @Column(name = "nonce_str")
    @ApiModelProperty(value = "随机字符串")
    private String nonceStr;

    @Column(name = "sign")
    @ApiModelProperty(value = "随机签名")
    private String sign;

    @Column(name = "gmt_greate")
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp gmtGreate;

    public void copy(Order source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
